package com.whosly.fast.web.quickly.command;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.stereotype.Component;

/**
 * Server Start Info
 */
@Component
public class ReadyCommandLineRunner implements CommandLineRunner {
    private static final Logger logger = LoggerFactory.getLogger(ReadyCommandLineRunner.class);

    @Autowired
    private ServerProperties serverProperties;

    @Override
    public void run(String... args) throws Exception {
        int port = serverProperties.getPort();
        String ip = "localhost"; // 在实际部署中需要动态获取IP地址

        logger.info("server http://{}:{} has start successfully.",
                ip, port);
    }
}
